﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace GPCSC.Web.CL_Menu_S
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        		protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(this.txtMenuName.Text.Trim().Length==0)
			{
				strErr+="MenuName不能为空！\\n";	
			}
			if(this.txtNavigateUrl.Text.Trim().Length==0)
			{
				strErr+="NavigateUrl不能为空！\\n";	
			}
			if(!PageValidate.IsNumber(txtMenuNum.Text))
			{
				strErr+="MenuNum格式错误！\\n";	
			}
			if(!PageValidate.IsNumber(txtDEPTH.Text))
			{
				strErr+="DEPTH格式错误！\\n";	
			}
			if(this.txtREMARK.Text.Trim().Length==0)
			{
				strErr+="REMARK不能为空！\\n";	
			}
			if(this.txtTARGET.Text.Trim().Length==0)
			{
				strErr+="TARGET不能为空！\\n";	
			}
			if(this.txtIconUrl.Text.Trim().Length==0)
			{
				strErr+="IconUrl不能为空！\\n";	
			}
			if(this.txtPARMenuName.Text.Trim().Length==0)
			{
				strErr+="PARMenuName不能为空！\\n";	
			}
			if(!PageValidate.IsNumber(txtNumber.Text))
			{
				strErr+="Number格式错误！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			string MenuName=this.txtMenuName.Text;
			string NavigateUrl=this.txtNavigateUrl.Text;
			int MenuNum=int.Parse(this.txtMenuNum.Text);
			int DEPTH=int.Parse(this.txtDEPTH.Text);
			string REMARK=this.txtREMARK.Text;
			string TARGET=this.txtTARGET.Text;
			string IconUrl=this.txtIconUrl.Text;
			string PARMenuName=this.txtPARMenuName.Text;
			int Number=int.Parse(this.txtNumber.Text);

			GPCSC.Model.CL_Menu_S model=new GPCSC.Model.CL_Menu_S();
			model.MenuName=MenuName;
			model.NavigateUrl=NavigateUrl;
			model.MenuNum=MenuNum;
			model.DEPTH=DEPTH;
			model.REMARK=REMARK;
			model.TARGET=TARGET;
			model.IconUrl=IconUrl;
			model.PARMenuName=PARMenuName;
			model.Number=Number;

			GPCSC.BLL.CL_Menu_S bll=new GPCSC.BLL.CL_Menu_S();
			bll.Add(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","add.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
